package com.slz3.business.module.wmsManagement.wmsPurchaseOrderSelf.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.wmsManagement.wmsPurchaseOrderSelf.domain.WmsPurchaseOrderSelf;
import com.slz3.business.module.wmsManagement.wmsPurchaseOrderSelf.domain.WmsPurchaseOrderSelfFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class WmsPurchaseOrderSelfTransactionalServiceImpl implements WmsPurchaseOrderSelfTransactionalService {

    @Override
    public WmsPurchaseOrderSelf modify(WmsPurchaseOrderSelf wmsPurchaseOrderSelfNew) {
        Repositorys.wmsPurchaseOrderSelf.test();
        Repositorys.wmsPurchaseOrderSelf.save(WmsPurchaseOrderSelfFactory.initBaseFields());
        System.err.println(1 / 0);
        wmsPurchaseOrderSelfNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.wmsPurchaseOrderSelf.saveAndFlush(wmsPurchaseOrderSelfNew);
    }

    @Override
    public List<WmsPurchaseOrderSelf> batchModify(List<WmsPurchaseOrderSelf> wmsPurchaseOrderSelfList) {
        return Repositorys.wmsPurchaseOrderSelf.saveAll(wmsPurchaseOrderSelfList);
    }
}
